package com.test.activiti.util;

import com.github.pagehelper.PageInfo;
import com.test.activiti.activiti.vo.PageResponse;

/**
 * @Author dzf62
 * @Description TODO
 * @Date 2023/9/4 20:26
 * @Version 1.0
 */
public class PageUtils {
    //将分页信息封装到统一的接口
    public static <T> PageResponse<T> getPageResult(PageInfo<T> pageInfo) {
        PageResponse<T> ts = new PageResponse<>();
        ts.setPage(pageInfo.getPageNum());
        ts.setPageSize(pageInfo.getPageSize());
        ts.setTotal(pageInfo.getTotal());
        ts.setTotalPages(pageInfo.getPages());
        ts.setData(pageInfo.getList());
        return ts;
    }
}
